﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Sunny.UI;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using Tools;

namespace Admin.登录
{
    public partial class Login : UILoginForm
    {
        public Login()
        {
            InitializeComponent();
        }

        private void Login_ButtonLoginClick(object sender, EventArgs e)
        {
            try
            {
                Models.Admin_1 m_admin = new Models.Admin_1();
                m_admin.admin_uname = UserName;
                m_admin.pwd = MD5Provider.Hash(Password);

                BLL.B_Admin b_admin = new BLL.B_Admin();
                if (b_admin.Login(m_admin) == 0)
                {
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    throw new Exception("用户名或密码错误");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }

    }
}
